package org.example.kafka;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.parser.Feature;
import org.apache.kafka.common.serialization.Deserializer;

import java.util.Map;

public class FastJsonDeserializer implements Deserializer<User> {
    @Override
    public void configure(Map<String, ?> configs, boolean isKey) {

    }

    @Override
    public User deserialize(String s, byte[] bytes) {
        if (bytes.length == 0)
            return null;
        return JSON.parseObject(bytes, User.class, Feature.IgnoreNotMatch);
    }

    @Override
    public void close() {

    }
}
